﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WPFChat.Model;
using be.metanous.mvvm.core;

namespace WPFChat.ViewModel
{
    public class MessageViewModel:ViewModelBase
    {
        
        private string _sender;

        public string Sender
        {
            get { return _sender; }
            set
            {
                if (_sender != value)
                {
                    _sender = value;
                    RaisePropertyChanged(() => Sender);
                    RaisePropertyChanged(() => FullContent);
                }
            }
        }

        private DateTime _timeStamp;

        public DateTime TimeStamp
        {
            get { return _timeStamp; }
            set
            {
                if (_timeStamp != value)
                {
                    _timeStamp = value;
                    RaisePropertyChanged(() => TimeStamp);
                    RaisePropertyChanged(() => FullContent);
                }
            }
        }

        private string _content;

        public string Content
        {
            get { return _content; }
            set
            {
                if (_content != value)
                {
                    _content = value;
                    RaisePropertyChanged(() => Content);
                    RaisePropertyChanged(() => FullContent);
                }
            }
        }

        private State _state;

        public State State
        {
            get { return _state; }
            set
            {
                if (_state != value)
                {
                    _state = value;
                    RaisePropertyChanged(() => State);
                }
            }
        }

        

        public string FullContent
        {
            get
            {
                return string.Format("[{0}] {1}: {2}", TimeStamp, Sender, Content);
            }
        }
    }
}
